package com.khyr.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.khyr.Vo.StockProducerV;
import com.khyr.Vo.StockProducerVo;

import com.khyr.entity.StockProducer;
import com.khyr.service.ProductService;
import com.khyr.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @className: ProductController
 * @author: Zyl
 * @date: 2025/3/12 14:57
 * @Version: 1.0
 * @description:
 */
@RestController
@RequestMapping("/erp/producter")
public class ProductController {
    @Autowired
    private ProductService productService;
    //生产厂家--条件加分页
    @PostMapping("/listProducterForPage")
    public R<Page<StockProducer>> findProduct(@RequestBody StockProducerVo stockProducerVo){
        return productService.findProduct(stockProducerVo);

    }
    //添加生产厂家
    @PostMapping("/addProducter")
    public R addProducter(@RequestBody StockProducerV data){
        return productService.addProducter(data);
    }
    //修改回显数据
    @PostMapping("/getProducterById/{producerId}")
    public R getProducterById(@PathVariable Integer producerId){
        return productService.getProducterById(producerId);
    }
    //修改数据
    @PutMapping("/updateProducter")
    public R updateProducter(@RequestBody StockProducerV data){
        return productService.updateProducter(data);
    }
    //删除数据
    @DeleteMapping("/deleteProducterByIds/{producerIds}")
    public R deleteProducterByIds(@PathVariable List<Integer>  producerIds){
        return productService.deleteProducterByIds(producerIds);
    }
    //查询所有有效的生产厂家信息
    @GetMapping("/selectAllProducter")
    public R<List<StockProducer>> selectAllProducter(){
        return productService.selectAllProducter();
    }



}
